package cn.zjitc.aop.book;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component("myAspect")
@Aspect
public class MyAspect {
    @Pointcut("execution(* cn.zjitc.aop.book.*..*())")
    private void myPointCut(){

    }
    @Before("myPointCut()")
    public void before(JoinPoint js){
        System.out.println("前置通知：模拟权限控制");
        System.out.println("目标对象："+ js.getTarget()+"，目标方法："+ js.getSignature().getName());
    }
    @AfterReturning("myPointCut()")
    public void afterReturning(JoinPoint js){
        System.out.println("后置通知：模拟记录日志");
        System.out.println("目标对象："+ js.getTarget()+"，目标方法："+ js.getSignature().getName());
    }
    @Around("myPointCut()")
    public Object around(ProceedingJoinPoint pjp){
        System.out.println();
        return null;
    }
}
